#include<iostream>
using namespace std;
#include<fstream>
#include<cmath>

#include"library.h"

int main(){

	int i,j;
	double A[4][4] = { {1,1,1,1}, {1,2,2,2}, {1,2,3,3}, {1,2,3,4} };
	int n=4;
	double **a = new double *[n];
	for(i=0;i<n;i++){
		a[i] = new double [n];
		for(j=0;j<n;j++){
			a[i][j] = A[i][j];
		}
	}
	int *pivot = new int [n];
	int sign = 1;
	ludcmp(4, a, pivot, sign);
	double determinant = sign;
	for(i=0;i<n;i++) determinant *= a[i][i];
	cout<<"determinant = "<<determinant<<endl;

	delete [] pivot;
	for(i=0;i<n;i++) delete [] a[i];
	delete [] a;

	return 0;
}
